Eclipse Platform
Pre-release 3.0

org.eclipse.jface.text
Class FragmentUpdater

java.lang.Object
  extended byorg.eclipse.jface.text.DefaultPositionUpdater
      extended byorg.eclipse.jface.text.FragmentUpdater
All Implemented Interfaces:
IPositionUpdater

public class FragmentUpdater
extends DefaultPositionUpdater

The position updater used to adapt the fragments of a projection document to changes of the master document. The updater supports two modes: a shifting mode and a non shifting mode. In the shifting mode the updater behaves identical to the DefaultPositionUpdater. In non shifting mode, if an insertion happens at a fragment's offset, the fragment is extended rather than shifted. Also, the last fragment is extended if an inserte operation happens at the end of the fragment.

This class is for internal use only.

Since:
2.1

Field Summary
 
Fields inherited from class org.eclipse.jface.text.DefaultPositionUpdater
fDocument, fLength, fOffset, fOriginalPosition, fPosition, fReplaceLength
 
Constructor Summary
protected FragmentUpdater(String fragmentCategory)
          Creates the fragment updater for the given category.
 
Method Summary
protected  void adaptToInsert()
          If an insertion happens at a fragment's offset, the fragment is extended rather than shifted.
 void enableShiftMode(boolean enable)
          Enables/disables the shift mode of this updater.
 void update(DocumentEvent event)
          Adapts positions to the change specified by the document event.
 
Methods inherited from class org.eclipse.jface.text.DefaultPositionUpdater
adaptToRemove, adaptToReplace, getCategory, notDeleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FragmentUpdater

protected FragmentUpdater(String fragmentCategory)
Creates the fragment updater for the given category.

Parameters:
fragmentCategory - the position category used for managing the fragments of a projection document
Method Detail

enableShiftMode

public void enableShiftMode(boolean enable)
Enables/disables the shift mode of this updater.

Parameters:
enable - true if shift mode should be enabled

adaptToInsert

protected void adaptToInsert()
If an insertion happens at a fragment's offset, the fragment is extended rather than shifted. Also, the last fragment is extended if an inserte operation happens at the end of the fragment.

Overrides:
adaptToInsert in class DefaultPositionUpdater

update

public void update(DocumentEvent event)
Description copied from interface: IPositionUpdater
Adapts positions to the change specified by the document event. It is ensured that the document's partitioning has been adapted to this document change and that all the position updaters which have a smaller index in the document's position updater list have been called.

Specified by:
update in interface IPositionUpdater
Overrides:
update in class DefaultPositionUpdater

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.